﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Threading;

using System.Diagnostics;

using Jarvis.Analytics;

namespace Jarvis.Windows
{
    /// <summary>
    /// Interaction logic for AboutWindow.xaml
    /// </summary>
    public partial class AboutWindow: Window
    {
        public AboutWindow()
        {
            InitializeComponent();
        }

        protected override void OnActivated(EventArgs e)
        {
            ((Jarvis.App)System.Windows.Application.Current).aboutWindow = this;
        }

        private void Window_Closing(object sender, CancelEventArgs e)
        {
            Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background,
                (DispatcherOperationCallback)delegate(object o)
                {
                    Hide();
                    return null;
                }, null);

            AnalyticsManager.LogEvent("Window Closing", "About");

            e.Cancel = true;
        }

        private void HandleRequestNavigate(object sender, RoutedEventArgs e)
        {
            string navigateUri = (sender as Hyperlink).NavigateUri.ToString();

            Process.Start(new ProcessStartInfo(navigateUri));
            
            e.Handled = true;
        }
    }
}
